﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace HZ.Supervise.Web.Hospital
{
    public partial class GoodsInfo2 : BasePage
    {
        HZ.Supervise.IBLL.IExecuteContext i = HZ.Supervise.BLLFactory.ExecuteContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request["did"] != null)
                {
                    SetBind();
                }
            }
        }
        private void SetBind()
        {
            string s = string.Format("and OrderDetailID='{0}'", Request["did"]);
            DataTable dt = i.GetOneDetailDXSB(s);
            if (dt.Rows.Count > 0)
            {
                txtBareprice.Text = dt.Rows[0]["Bareprice"].ToString();
                //txtPackage.Text = dt.Rows[0]["Package"].ToString();
                //txtPackprice.Text = dt.Rows[0]["Packprice"].ToString();
                //txtSoftware.Text = dt.Rows[0]["Software"].ToString();
                txtPrice.Text = dt.Rows[0]["Price"].ToString();
                txtOtherPackage.Text = dt.Rows[0]["OtherPackage"].ToString();

                ddlPaymethod.SelectedValue = dt.Rows[0]["Paymethod"].ToString();
                if (dt.Rows[0]["Paymethod"].ToString() == "分期")
                {
                    txtFirstprice.Text = dt.Rows[0]["Firstprice"].ToString();
                    txtPaytimes.Text = dt.Rows[0]["Paytimes"].ToString();
                    txtFirstPayTime.Text = dt.Rows[0]["FirstPayTime"].ToString();
                    trPay1.Visible = true;
                    trPay2.Visible = true;
                }
                else
                {
                    trPay1.Visible = false;
                    trPay2.Visible = false;
                }
                txtPayterm.Text = dt.Rows[0]["Payterm"].ToString();

                //ddlIsLifeTime.SelectedValue = dt.Rows[0]["IsLifeTime"].ToString();
                //if (dt.Rows[0]["IsLifeTime"].ToString() == "0")
                //{
                //    trlife.Visible = true;
                //    txtFreedate.Text = dt.Rows[0]["Freedate"].ToString();
                //    txtAfterPay.Text = dt.Rows[0]["AfterPay"].ToString();
                //    txtAfterContent.Text = dt.Rows[0]["AfterContent"].ToString();
                //}
                //else
                //{
                //    txtFreedate.Visible = false;
                //    lblFreedate.Visible = false;
                //    trlife.Visible = false;
                //}

                txtCompanyName_JX.Text = dt.Rows[0]["CompanyName_JX"].ToString();
                txtCount.Text = dt.Rows[0]["Purchasecount"].ToString();
                txtRemarks.Text = dt.Rows[0]["Remarks"].ToString();
                //ddlbeiyong.SelectedValue = dt.Rows[0]["IsBeiYong"].ToString();
                if (dt.Rows[0]["PurchaseType"].ToString() == "公开招标" || dt.Rows[0]["PurchaseType"].ToString() == "邀请招标" || dt.Rows[0]["PurchaseType"].ToString() == "竞争性谈判" || dt.Rows[0]["PurchaseType"].ToString() == "单一来源采购" || dt.Rows[0]["PurchaseType"].ToString() == "询价采购")
                {
                    ddlType.SelectedValue = "政府采购";
                    ddlGovType.SelectedValue = dt.Rows[0]["PurchaseType"].ToString();
                    ddlGovType.Visible = true;
                    txtOtherType.Visible = false;
                }
                else
                {
                    ddlType.SelectedValue = "其他";
                    txtOtherType.Text = dt.Rows[0]["PurchaseType"].ToString();
                    ddlGovType.Visible = false;
                    txtOtherType.Visible = true;
                }
            }
        }
    }
}